﻿<UserControl x:Class="Frontend.DateTimeFilterPanel"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
             xmlns:system="clr-namespace:System;assembly=mscorlib"
             x:Name="RootControl">
    <Expander Name="Expander" IsExpanded="False">
        <Expander.Header>
            <CheckBox Name="UseManualFilterCheckbox"
                          Click="UseManualFilterCheckbox_Clicked"
                          Checked="UseManualFilterCheckbox_Checked">
                Date and Time Filter
            </CheckBox>
        </Expander.Header>
        <GroupBox Margin="2" Padding="2"
                  IsEnabled="{Binding ElementName=UseManualFilterCheckbox, Path=IsChecked}">
            <Grid >          
                <Grid.Resources>
                    <Style x:Key="LabelStyle">
                        <Setter Property="Control.Margin" Value="10 1 1 1" />
                        <Setter Property="Control.Padding" Value="2" />
                        <Setter Property="FrameworkElement.HorizontalAlignment" Value="Left" />
                    </Style>
                    <Style x:Key="ControlStyle">
                        <Setter Property="Control.Margin" Value="2"  />
                        <Setter Property="Control.Padding" Value="1" />
                    </Style>
                    <Style x:Key="ComboBoxStyle" BasedOn="{StaticResource ControlStyle}">
                        <Setter Property="Control.HorizontalContentAlignment" Value="Center" />
                        <Setter Property="Control.VerticalContentAlignment" Value="Center" />
                    </Style>
                    <Style x:Key="HyperlinkStyle">
                        <Setter Property="Control.Margin" Value="1" />
                        <Setter Property="Control.IsEnabled" 
                                Value="{Binding ElementName=UseManualFilterCheckbox, Path=IsChecked}" />                                
                    </Style>
                </Grid.Resources>
                <Grid.RowDefinitions>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="1*"/>
                    <RowDefinition Height="1*"/>                    
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width ="1*"/>
                    <ColumnDefinition Width ="1*"/>
                </Grid.ColumnDefinitions>
                
                <TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource  LabelStyle}">Start Date</TextBlock>
                <TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource  LabelStyle}">Duration</TextBlock>
                <TextBlock Grid.Row="2" Grid.Column="0" Style="{StaticResource  LabelStyle}" Opacity="{Binding}">Begin Time</TextBlock>
                <TextBlock Grid.Row="2" Grid.Column="1" Style="{StaticResource  LabelStyle}">End Time</TextBlock>
                <TextBlock Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2" 
                           Margin="1 5 2 2"
                           Style="{StaticResource  LabelStyle}">Predefined presets:</TextBlock>

                <toolkit:DatePicker Grid.Row="1" Grid.Column="0" x:Name="DateBeginPicker" 
                                    Padding="0" Style="{StaticResource ControlStyle}"
                                    SelectedDate="{x:Static Member=system:DateTime.Now}"
                                    DisplayDate="{Binding Path=SelectedDate, RelativeSource={RelativeSource Self}}" >                    
                    
                </toolkit:DatePicker>
                <ComboBox Grid.Row="1" Grid.Column="1" x:Name="DateDurationComboBox"
                          Style="{StaticResource  ComboBoxStyle}" /> 
                    
                <ComboBox Grid.Row="3" Grid.Column="0" x:Name="TimeBeginComboBox"
                          Style="{StaticResource  ComboBoxStyle}" />
              
                <ComboBox Grid.Row="3" Grid.Column="1" x:Name="TimeEndComboBox"
                          Style="{StaticResource  ComboBoxStyle}" />                    
               
                <GroupBox Grid.Row="5" Grid.Column="0" Margin="1"
                          HorizontalContentAlignment="Center">
                    <GroupBox.Header>
                        <TextBlock> By Date </TextBlock>
                    </GroupBox.Header>
                    <StackPanel HorizontalAlignment="Center">
                        <TextBlock>
                            <Hyperlink Style="{StaticResource HyperlinkStyle}" 
                                       Click="PredefinedPreset_DateThisWeek">
                                this week
                            </Hyperlink>
                        </TextBlock>
                        <TextBlock>
                            <Hyperlink Style="{StaticResource HyperlinkStyle}"
                                       Click="PredefinedPreset_DateNextWeek"> 
                              next week 
                            </Hyperlink>
                        </TextBlock>
                        <TextBlock>
                            <Hyperlink Style="{StaticResource HyperlinkStyle}"
                                       Click="PredefinedPreset_DateTwoWeeks">
                                two weeks 
                            </Hyperlink>
                        </TextBlock>
                    </StackPanel>
                </GroupBox>


                <GroupBox Grid.Row="5" Grid.Column="1" Margin="1" Foreground="Black"
                          HorizontalContentAlignment="Center">
                    <GroupBox.Header>
                        <TextBlock> By Time </TextBlock>
                    </GroupBox.Header>
                    <StackPanel HorizontalAlignment="Center">
                        <TextBlock>
                            <Hyperlink Style="{StaticResource HyperlinkStyle}"
                                       Click="PredefinedPreset_TimeFullDay">
                                full day 
                            </Hyperlink>
                        </TextBlock>

                        <TextBlock>
                            <Hyperlink Style="{StaticResource HyperlinkStyle}"
                                       Click="PredefinedPreset_TimeMorning">
                                morning 
                            </Hyperlink>
                        </TextBlock>
                        <TextBlock>
                            <Hyperlink Style="{StaticResource HyperlinkStyle}"
                                       Click="PredefinedPreset_TimeMidday">
                                midday 
                            </Hyperlink>
                        </TextBlock>
                        <TextBlock>
                            <Hyperlink Style="{StaticResource HyperlinkStyle}"
                                       Click="PredefinedPreset_TimeEvening">
                                evening 
                            </Hyperlink>
                        </TextBlock>
                    </StackPanel>
                </GroupBox>            
            </Grid>
        </GroupBox>        
    </Expander>    
    
</UserControl>

    